Moved course calculation to grtcirc so I could use it with trackfilter
authorparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 7 Apr 2006 14:40:56 +0000 (14:40 +0000)
committerparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 7 Apr 2006 14:40:56 +0000 (14:40 +0000)
gpsbabel/garmin_txt.c

index b6b19fb9e3571faceaff092c2feba1bd5e9d078c..15f55a311034f09cc921ed8908d0808c8296be57 100644 (file)
@@ -289,21 +289,10 @@ distance(double lat1, double lon1, double lat2, double lon2)      /* nearly MapSource
        return r2d(gcdist(d2r(lat1), d2r(lon1), d2r(lat2), d2r(lon2))) * 111.32 * 1000.0;
 }
 
-static double
-course_rad(double lat1, double lon1, double lat2, double lon2)
-{
-       double v1, v2;
-       v1 = sin(lon1 - lon2) * cos(lat2);
-       v2 = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1 - lon2);
-       if (fabs(v2) < 0.000000000000001) v2 = 0.0;     /* fix calculation diff. between 32- and 64-bit systems */
-       if (fabs(v1) < 0.000000000000001) v1 = 0.0;     /* fix calculation diff. between 32- and 64-bit systems */
-       return atan2(v1, v2);
-}
-
 static double
 course_deg(double lat1, double lon1, double lat2, double lon2)
 {
-       return r2d(course_rad(d2r(lat1), d2r(lon1), d2r(lat2), d2r(lon2)));
+       return r2d(heading(d2r(lat1), d2r(lon1), d2r(lat2), d2r(lon2)));
 }
 
 static double